<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Ev class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ev.periodic-modes.html">Periodic watcher operation modes</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ev.backend.html">Ev::backend</a></div>
 <div class="up"><a href="book.ev.html">Ev</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.ev" class="reference">
 <h1 class="title">The Ev class</h1>
 
 <div class="partintro"><p class="verinfo">(PECL ev &gt;= 0.2.0)</p>

  <div class="section" id="ev.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    Ev is a singleton providing access to the default loop and to some common
    operations.
   </p>
  </div>

  <div class="section" id="ev.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">final</span>
      <strong class="classname">Ev</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.flag-auto"><var class="varname">FLAG_AUTO</var></a></var>
     <span class="initializer"> = 0</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.flag-noenv"><var class="varname">FLAG_NOENV</var></a></var>
     <span class="initializer"> = 16777216</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.flag-forkcheck"><var class="varname">FLAG_FORKCHECK</var></a></var>
     <span class="initializer"> = 33554432</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.flag-noinotify"><var class="varname">FLAG_NOINOTIFY</var></a></var>
     <span class="initializer"> = 1048576</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.flag-signalfd"><var class="varname">FLAG_SIGNALFD</var></a></var>
     <span class="initializer"> = 2097152</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.flag-nosigmask"><var class="varname">FLAG_NOSIGMASK</var></a></var>
     <span class="initializer"> = 4194304</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.run-nowait"><var class="varname">RUN_NOWAIT</var></a></var>
     <span class="initializer"> = 1</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.run-once"><var class="varname">RUN_ONCE</var></a></var>
     <span class="initializer"> = 2</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.break-cancel"><var class="varname">BREAK_CANCEL</var></a></var>
     <span class="initializer"> = 0</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.break-one"><var class="varname">BREAK_ONE</var></a></var>
     <span class="initializer"> = 1</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.break-all"><var class="varname">BREAK_ALL</var></a></var>
     <span class="initializer"> = 2</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.minpri"><var class="varname">MINPRI</var></a></var>
     <span class="initializer"> = -2</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.maxpri"><var class="varname">MAXPRI</var></a></var>
     <span class="initializer"> = 2</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.read"><var class="varname">READ</var></a></var>
     <span class="initializer"> = 1</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.write"><var class="varname">WRITE</var></a></var>
     <span class="initializer"> = 2</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.timer"><var class="varname">TIMER</var></a></var>
     <span class="initializer"> = 256</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.periodic"><var class="varname">PERIODIC</var></a></var>
     <span class="initializer"> = 512</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.signal"><var class="varname">SIGNAL</var></a></var>
     <span class="initializer"> = 1024</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.child"><var class="varname">CHILD</var></a></var>
     <span class="initializer"> = 2048</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.stat"><var class="varname">STAT</var></a></var>
     <span class="initializer"> = 4096</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.idle"><var class="varname">IDLE</var></a></var>
     <span class="initializer"> = 8192</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.prepare"><var class="varname">PREPARE</var></a></var>
     <span class="initializer"> = 16384</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.check"><var class="varname">CHECK</var></a></var>
     <span class="initializer"> = 32768</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.embed"><var class="varname">EMBED</var></a></var>
     <span class="initializer"> = 65536</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.custom"><var class="varname">CUSTOM</var></a></var>
     <span class="initializer"> = 16777216</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.error"><var class="varname">ERROR</var></a></var>
     <span class="initializer"> = 2147483648</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.backend-select"><var class="varname">BACKEND_SELECT</var></a></var>
     <span class="initializer"> = 1</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.backend-poll"><var class="varname">BACKEND_POLL</var></a></var>
     <span class="initializer"> = 2</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.backend-epoll"><var class="varname">BACKEND_EPOLL</var></a></var>
     <span class="initializer"> = 4</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.backend-kqueue"><var class="varname">BACKEND_KQUEUE</var></a></var>
     <span class="initializer"> = 8</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.backend-devpoll"><var class="varname">BACKEND_DEVPOLL</var></a></var>
     <span class="initializer"> = 16</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.backend-port"><var class="varname">BACKEND_PORT</var></a></var>
     <span class="initializer"> = 32</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.backend-all"><var class="varname">BACKEND_ALL</var></a></var>
     <span class="initializer"> = 63</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.ev.html#ev.constants.backend-mask"><var class="varname">BACKEND_MASK</var></a></var>
     <span class="initializer"> = 65535</span>
    ;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">int</span>
   <span class="methodname"><a href="ev.backend.html" class="methodname">backend</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">int</span>
   <span class="methodname"><a href="ev.depth.html" class="methodname">depth</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.embeddablebackends.html" class="methodname">embeddableBackends</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.feedsignal.html" class="methodname">feedSignal</a></span>
    ( <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$signum</code>
   </span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.feedsignalevent.html" class="methodname">feedSignalEvent</a></span>
    ( <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$signum</code>
   </span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">int</span>
   <span class="methodname"><a href="ev.iteration.html" class="methodname">iteration</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">double</span>
   <span class="methodname"><a href="ev.now.html" class="methodname">now</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.nowupdate.html" class="methodname">nowUpdate</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.recommendedbackends.html" class="methodname">recommendedBackends</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.resume.html" class="methodname">resume</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.run.html" class="methodname">run</a></span>
    ([ <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$flags</code>
   </span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.sleep.html" class="methodname">sleep</a></span>
    ( <span class="methodparam">
    <span class="type">double</span>
     <code class="parameter">$seconds</code>
   </span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.stop.html" class="methodname">stop</a></span>
    ([ <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$how</code>
   </span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.supportedbackends.html" class="methodname">supportedBackends</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.suspend.html" class="methodname">suspend</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">double</span>
   <span class="methodname"><a href="ev.time.html" class="methodname">time</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">void</span>
   <span class="methodname"><a href="ev.verify.html" class="methodname">verify</a></span>
    ( <span class="methodparam">void</span>
   )</div>

   }</div>

  </div>

  <div class="section" id="ev.constants">
   <h2 class="title">预定义常量</h2>

  <p class="para" id="ev.constants.loop-flags">
    Flags passed to create a loop:

    <dl>

     
      <dt id="ev.constants.flag-auto">
       <strong><code>Ev::FLAG_AUTO</code></strong>
      </dt>

      <dd>

       <p class="para">
        The default flags value
       </p>
      </dd>

     
     
      <dt id="ev.constants.flag-noenv">
       <strong><code>Ev::FLAG_NOENV</code></strong>
      </dt>

      <dd>

       <p class="para">
        If this flag used(or the program runs setuid or setgid),
        <em>libev</em>
        won&#039;t look at the environment variable
        <var class="varname"><var class="varname">LIBEV_FLAGS</var></var>
        . Otherwise(by default),
        <var class="varname"><var class="varname">LIBEV_FLAGS</var></var>
        will override the flags completely if it is found. Useful for
        performance tests and searching for bugs.
       </p>
      </dd>

     
     
      <dt id="ev.constants.flag-forkcheck">
       <strong><code>Ev::FLAG_FORKCHECK</code></strong>
      </dt>

      <dd>

       <p class="para">
        Makes libev check for a fork in each iteration, instead of calling
        <span class="methodname"><a href="evloop.fork.html" class="methodname">EvLoop::fork()</a></span>
        manually. This works by calling
        <em>getpid()</em>
        on every iteration of the loop, and thus this might slow down the
        event loop with lots of loop iterations, but usually is not
        noticeable. This flag setting cannot be overridden or specified in the
        <var class="varname"><var class="varname">LIBEV_FLAGS</var></var>
        environment variable.
       </p>
      </dd>

     
     
      <dt id="ev.constants.flag-noinotify">
       <strong><code>Ev::FLAG_NOINOTIFY</code></strong>
      </dt>

      <dd>

       <p class="para">
        When this flag is specified,
        <em>libev</em>
        won&#039;t attempt to use the
        <em>inotify</em>
        API for its
        <a href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_stat_code_did_the_file_attri" class="link external">&raquo;&nbsp;ev_stat</a>
        watchers. The flag can be useful to conserve inotify file descriptors,
        as otherwise each loop using
        <em>ev_stat</em>
        watchers consumes one
        <em>inotify</em>
        handle.
       </p>
      </dd>

     
     
      <dt id="ev.constants.flag-signalfd">
       <strong><code>Ev::FLAG_SIGNALFD</code></strong>
      </dt>

      <dd>

       <p class="para">
        When this flag is specified,
        <em>libev</em>
        will attempt to use the
        <em>signalfd</em>
        API for its
        <a href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_signal_code_signal_me_when_a" class="link external">&raquo;&nbsp;ev_signal</a>
        (and
        <a href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_child_code_watch_out_for_pro" class="link external">&raquo;&nbsp;ev_child</a>
        ) watchers. This API delivers signals synchronously, which makes it
        both faster and might make it possible to get the queued signal data.
        It can also simplify signal handling with threads, as long as signals
        are properly blocked in threads.
        <em>Signalfd</em>
        will not be used by default.
       </p>
      </dd>

     
     
      <dt id="ev.constants.flag-nosigmask">
       <strong><code>Ev::FLAG_NOSIGMASK</code></strong>
      </dt>

      <dd>

       <p class="para">
        When this flag is specified,
        <em>libev</em>
        will avoid to modify the signal mask. Specifically, this means having
        to make sure signals are unblocked before receiving them.
       </p>
       <p class="para">
        This behaviour is useful for custom signal handling, or handling
        signals only in specific threads.
       </p>
      </dd>

     
    </dl>

   </p>

   <p class="para" id="ev.constants.run-flags">
    Flags passed to
    <span class="methodname"><a href="ev.run.html" class="methodname">Ev::run()</a></span>
    , or
    <span class="methodname"><a href="evloop.run.html" class="methodname">EvLoop::run()</a></span>

    <dl>

     
      <dt id="ev.constants.run-nowait">
       <strong><code>Ev::RUN_NOWAIT</code></strong>
      </dt>

      <dd>

       <p class="para">
        Means that event loop will look for new events, will handle those
        events and any already outstanding ones, but will not wait and block
        the process in case there are no events and will return after one
        iteration of the loop. This is sometimes useful to poll and handle new
        events while doing lengthy calculations, to keep the program
        responsive.
       </p>
      </dd>

     
     
      <dt id="ev.constants.run-once">
       <strong><code>Ev::RUN_ONCE</code></strong>
      </dt>

      <dd>

       <p class="para">
        Means that event loop will look for new events (waiting if necessary)
        and will handle those and any already outstanding ones. It will block
        the process until at least one new event arrives (which could be an
        event internal to libev itself, so there is no guarantee that a
        user-registered callback will be called), and will return after one
        iteration of the loop.
       </p>
      </dd>

     
    </dl>

   </p>

   <p class="para" id="ev.constants.break-flags">
    Flags passed to
    <span class="methodname"><a href="ev.stop.html" class="methodname">Ev::stop()</a></span>
    , or
    <span class="methodname"><a href="evloop.stop.html" class="methodname">EvLoop::stop()</a></span>

    <dl>

     
      <dt id="ev.constants.break-cancel">
       <strong><code>Ev::BREAK_CANCEL</code></strong>
      </dt>

      <dd>

       <p class="para">
        Cancel the break operation.
       </p>
      </dd>

     
     
      <dt id="ev.constants.break-one">
       <strong><code>Ev::BREAK_ONE</code></strong>
      </dt>

      <dd>

       <p class="para">
        Makes the innermost
        <span class="methodname"><a href="ev.run.html" class="methodname">Ev::run()</a></span>
        (or
        <span class="methodname"><a href="evloop.run.html" class="methodname">EvLoop::run()</a></span>
        ) call return.
       </p>
      </dd>

     
     
      <dt id="ev.constants.break-all">
       <strong><code>Ev::BREAK_ALL</code></strong>
      </dt>

      <dd>

       <p class="para">
        Makes all nested
        <span class="methodname"><a href="ev.run.html" class="methodname">Ev::run()</a></span>
        (or
        <span class="methodname"><a href="evloop.run.html" class="methodname">EvLoop::run()</a></span>
        ) calls return.
       </p>
      </dd>

     
    </dl>

   </p>

   <p class="para" id="ev.constants.watcher-pri">
    Watcher priorities:

    <dl>

     
      <dt id="ev.constants.minpri">
       <strong><code>Ev::MINPRI</code></strong>
      </dt>

      <dd>

       <p class="para">
        Minimum allowed watcher priority.
       </p>
      </dd>

     
     
      <dt id="ev.constants.maxpri">
       <strong><code>Ev::MAXPRI</code></strong>
      </dt>

      <dd>

       <p class="para">
        Maximum allowed watcher priority.
       </p>
      </dd>

     
    </dl>

   </p>

   <p class="para" id="ev.constants.watcher-revents">
    Bit masks of (received) events:

    <dl>

     
      <dt id="ev.constants.read">
       <strong><code>Ev::READ</code></strong>
      </dt>

      <dd>

       <p class="para">
        The file descriptor in the
        <a href="class.evio.html" class="classname">EvIo</a>
        watcher has become readable.
       </p>
      </dd>

     
     
      <dt id="ev.constants.write">
       <strong><code>Ev::WRITE</code></strong>
      </dt>

      <dd>

       <p class="para">
        The file descriptor in the
        <a href="class.evio.html" class="classname">EvIo</a>
        watcher has become writable.
       </p>
      </dd>

     
     
      <dt id="ev.constants.timer">
       <strong><code>Ev::TIMER</code></strong>
      </dt>

      <dd>

       <p class="para">
        <a href="class.evtimer.html" class="classname">EvTimer</a>
        watcher has been timed out.
       </p>
      </dd>

     
     
      <dt id="ev.constants.periodic">
       <strong><code>Ev::PERIODIC</code></strong>
      </dt>

      <dd>

       <p class="para">
        <a href="class.evperiodic.html" class="classname">EvPeriodic</a>
        watcher has been timed out.
       </p>
      </dd>

     
     
      <dt id="ev.constants.signal">
       <strong><code>Ev::SIGNAL</code></strong>
      </dt>

      <dd>

       <p class="para">
        A signal specified in
        <span class="methodname"><a href="evsignal.construct.html" class="methodname">EvSignal::__construct()</a></span>
        has been received.
       </p>
      </dd>

     
     
      <dt id="ev.constants.child">
       <strong><code>Ev::CHILD</code></strong>
      </dt>

      <dd>

       <p class="para">
        The
        <em><code class="parameter">pid</code></em>
        specified in
        <span class="methodname"><a href="evchild.construct.html" class="methodname">EvChild::__construct()</a></span>
        has received a status change.
       </p>
      </dd>

     
     
      <dt id="ev.constants.stat">
       <strong><code>Ev::STAT</code></strong>
      </dt>

      <dd>

       <p class="para">
        The path specified in
        <a href="class.evstat.html" class="classname">EvStat</a>
        watcher changed its attributes.
       </p>
      </dd>

     
     
      <dt id="ev.constants.idle">
       <strong><code>Ev::IDLE</code></strong>
      </dt>

      <dd>

       <p class="para">
        <a href="class.evidle.html" class="classname">EvIdle</a>
        watcher works when there is nothing to do with other watchers.
       </p>
      </dd>

     
     
      <dt id="ev.constants.prepare">
       <strong><code>Ev::PREPARE</code></strong>
      </dt>

      <dd>

       <p class="para">
        All
        <a href="class.evprepare.html" class="classname">EvPrepare</a>
        watchers are invoked just before
        <span class="methodname"><a href="ev.run.html" class="methodname">Ev::run()</a></span>
        starts. Thus,
        <a href="class.evprepare.html" class="classname">EvPrepare</a>
        watchers are the last watchers invoked before the event loop sleeps or
        polls for new events.
       </p>
      </dd>

     
     
      <dt id="ev.constants.check">
       <strong><code>Ev::CHECK</code></strong>
      </dt>

      <dd>

       <p class="para">
        All
        <a href="class.evcheck.html" class="classname">EvCheck</a>
        watchers are queued just after
        <span class="methodname"><a href="ev.run.html" class="methodname">Ev::run()</a></span>
        has gathered the new events, but before it queues any callbacks for
        any received events. Thus,
        <a href="class.evcheck.html" class="classname">EvCheck</a>
        watchers will be invoked before any other watchers of the same or
        lower priority within an event loop iteration.
       </p>
      </dd>

     
     
      <dt id="ev.constants.embed">
       <strong><code>Ev::EMBED</code></strong>
      </dt>

      <dd>

       <p class="para">
        The embedded event loop specified in the
        <a href="class.evembed.html" class="classname">EvEmbed</a>
        watcher needs attention.
       </p>
      </dd>

     
     
      <dt id="ev.constants.custom">
       <strong><code>Ev::CUSTOM</code></strong>
      </dt>

      <dd>

       <p class="para">
        Not ever sent(or otherwise used) by
        <em>libev</em>
        itself, but can be freely used by
        <em>libev</em>
        users to signal watchers (e.g. via
        <span class="methodname"><a href="evwatcher.feed.html" class="methodname">EvWatcher::feed()</a></span>
        ).
       </p>
      </dd>

     
     
      <dt id="ev.constants.error">
       <strong><code>Ev::ERROR</code></strong>
      </dt>

      <dd>

       <p class="para">
        An unspecified error has occurred, the watcher has been stopped. This
        might happen because the watcher could not be properly started because
        <em>libev</em>
        ran out of memory, a file descriptor was found to be closed or any
        other problem.
        <em>Libev</em>
        considers these application bugs. See also
        <a href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#ANATOMY_OF_A_WATCHER_CONTENT" class="link external">&raquo;&nbsp;ANATOMY
    OF A WATCHER</a>
       </p>
      </dd>

     
    </dl>

   </p>

   <p class="para" id="ev.constants.watcher-backends">
    Backend flags:

    <dl>

     
      <dt id="ev.constants.backend-select">
       <strong><code>Ev::BACKEND_SELECT</code></strong>
      </dt>

      <dd>

       <p class="para">
        <em>select(2) backend</em>
       </p>
      </dd>

     
     
      <dt id="ev.constants.backend-poll">
       <strong><code>Ev::BACKEND_POLL</code></strong>
      </dt>

      <dd>

       <p class="para">
        <em>poll(2) backend</em>
       </p>
      </dd>

     
     
      <dt id="ev.constants.backend-epoll">
       <strong><code>Ev::BACKEND_EPOLL</code></strong>
      </dt>

      <dd>

       <p class="para">
        Linux-specific
        <em>epoll(7)</em>
        backend for both pre- and post-2.6.9 kernels
       </p>
      </dd>

     
     
      <dt id="ev.constants.backend-kqueue">
       <strong><code>Ev::BACKEND_KQUEUE</code></strong>
      </dt>

      <dd>

       <p class="para">
        <em>kqueue</em>
        backend used on most BSD systems.
        <a href="class.evembed.html" class="classname">EvEmbed</a>
        watcher could be used to embed one loop(with kqueue backend) into
        another. For instance, one can try to create an event loop with
        <em>kqueue</em>
        backend and use it for sockets only.
       </p>
      </dd>

     
     
      <dt id="ev.constants.backend-devpoll">
       <strong><code>Ev::BACKEND_DEVPOLL</code></strong>
      </dt>

      <dd>

       <p class="para">
        Solaris 8 backend. This is not implemented yet.
       </p>
      </dd>

     
     
      <dt id="ev.constants.backend-port">
       <strong><code>Ev::BACKEND_PORT</code></strong>
      </dt>

      <dd>

       <p class="para">
        Solaris 10 event port mechanism with a good scaling.
       </p>
      </dd>

     
     
      <dt id="ev.constants.backend-all">
       <strong><code>Ev::BACKEND_ALL</code></strong>
      </dt>

      <dd>

       <p class="para">
        Try all backends(even currupted ones). It&#039;s not recommended to use it
        explicitly. Bitwise operators should be applied here(e.g.
        <strong><code>Ev::BACKEND_ALL</code></strong>
        &amp; ~
        <strong><code>Ev::BACKEND_KQUEUE</code></strong>
        ) Use
        <span class="methodname"><a href="ev.recommendedbackends.html" class="methodname">Ev::recommendedBackends()</a></span>
        , or don&#039;t specify any backends at all.
       </p>
      </dd>

     
     
      <dt id="ev.constants.backend-mask">
       <strong><code>Ev::BACKEND_MASK</code></strong>
      </dt>

      <dd>

       <p class="para">
        Not a backend, but a mask to select all backend bits from
        <em><code class="parameter">flags</code></em>
        value to mask out any backends(e.g. when modifying the
        <var class="varname"><var class="varname">LIBEV_FLAGS</var></var>
        environment variable).
       </p>
      </dd>

     
    </dl>

   </p>

   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     For the default loop during module initialization phase
     <em>Ev</em>
     registers
     <a href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_EVENT_LOOPS_CO" class="link external">&raquo;&nbsp;ev_loop_fork</a>
     call by means of
     <em>pthread_atfork</em>
     (if available).
    </p>
   </p></blockquote>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     There are methods providing access to the
     <em class="emphasis">default event
   loop</em>
     in
     <strong class="classname">Ev</strong>
     class(e.g.
     <span class="methodname"><a href="ev.iteration.html" class="methodname">Ev::iteration()</a></span>
     ,
     <span class="methodname"><a href="ev.depth.html" class="methodname">Ev::depth()</a></span>
     etc.) For
     <em class="emphasis">custom loops</em>
     (created with
     <span class="methodname"><a href="evloop.construct.html" class="methodname">EvLoop::__construct()</a></span>
     ) these values may be accessed via corresponding properties and methods
     of the
     <a href="class.evloop.html" class="classname">EvLoop</a>
     class.
    </p>
    <p class="para">
     The instance of the default event loop itself can be fetched by means of
     <span class="methodname"><a href="evloop.defaultloop.html" class="methodname">EvLoop::defaultLoop()</a></span>
     method.
    </p>
   </p></blockquote>
  </div>

 </div>

 






















































































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="ev.backend.html">Ev::backend</a> — Returns an integer describing the backend used by libev.</li><li><a href="ev.depth.html">Ev::depth</a> — Returns recursion depth</li><li><a href="ev.embeddablebackends.html">Ev::embeddableBackends</a> — Returns the set of backends that are embeddable in other event loops.</li><li><a href="ev.feedsignal.html">Ev::feedSignal</a> — Feed a signal event info Ev</li><li><a href="ev.feedsignalevent.html">Ev::feedSignalEvent</a> — Feed signal event into the default loop</li><li><a href="ev.iteration.html">Ev::iteration</a> — Return the number of times the default event loop has polled for new
  events.</li><li><a href="ev.now.html">Ev::now</a> — Returns the time when the last iteration of the default event
  loop has started.</li><li><a href="ev.nowupdate.html">Ev::nowUpdate</a> — Establishes the current time by querying the kernel, updating the time
    returned by Ev::now in the progress.</li><li><a href="ev.recommendedbackends.html">Ev::recommendedBackends</a> — Returns a bit mask of recommended backends for current
  platform.</li><li><a href="ev.resume.html">Ev::resume</a> — Resume previously suspended default event loop</li><li><a href="ev.run.html">Ev::run</a> — Begin checking for events and calling callbacks for the default
  loop</li><li><a href="ev.sleep.html">Ev::sleep</a> — Block the process for the given number of seconds.</li><li><a href="ev.stop.html">Ev::stop</a> — Stops the default event loop</li><li><a href="ev.supportedbackends.html">Ev::supportedBackends</a> — Returns the set of backends supported by current libev
  configuration.</li><li><a href="ev.suspend.html">Ev::suspend</a> — Suspend the default event loop</li><li><a href="ev.time.html">Ev::time</a> — Returns the current time in fractional seconds since the epoch.</li><li><a href="ev.verify.html">Ev::verify</a> — Performs internal consistency checks(for debugging)</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ev.periodic-modes.html">Periodic watcher operation modes</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ev.backend.html">Ev::backend</a></div>
 <div class="up"><a href="book.ev.html">Ev</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
